package ooday03.JavaStanardHomework.AnimalAndRefArrayDemo01;
/** 演示RefArrayDemo01类 */
public class RefArrayDemo01 {
    public static void main(String[] args) {
        Dog1[] dogs = new Dog1[3];
        dogs[0] = new Dog1("小黑", 3, "黑");
        dogs[1] = new Dog1("小黄", 2, "黄");
        dogs[2] = new Dog1("小蓝", 4, "蓝");
        for(int i = 0; i < dogs.length; i++) {
            System.out.println(dogs[i].name);
            System.out.println(dogs[i].age);
            System.out.println(dogs[i].color);
            dogs[i].eat();
            dogs[i].drink();
            dogs[i].lookHome();
            dogs[i].swim();
            System.out.println();
        }

        System.out.println();

        Chick1[] chicks = new Chick1[3];
        chicks[0] = new Chick1("小青", 2, "青");
        chicks[1] = new Chick1("小金", 3, "金");
        chicks[2] = new Chick1("大金", 5, "金");
        for(int i = 0; i < chicks.length; i++) {
            System.out.println(chicks[i].name);
            System.out.println(chicks[i].age);
            System.out.println(chicks[i].color);
            chicks[i].eat();
            chicks[i].drink();
            chicks[i].layEggs();
            System.out.println();
        }

        System.out.println();

        Fish1[] fish = new Fish1[3];
        fish[0] = new Fish1("小红", 3, "红");
        fish[1] = new Fish1("小绿", 2, "绿");
        fish[2] = new Fish1("小紫", 4, "紫");
        for(int i = 0; i < fish.length; i++) {
            System.out.println(fish[i].name);
            System.out.println(fish[i].age);
            System.out.println(fish[i].color);
            fish[i].eat();
            fish[i].drink();
            fish[i].swim();
            System.out.println();
        }
    }
}
